package mypackage3;
import java.util.Scanner;
public class StringAddCircle {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        while (true){
            System.out.println("请输入第一个字符串");
            StringBuilder sb=new StringBuilder(sc.next());
            sb.append(sb);
            System.out.println("请输入第二个字符串");
            String str=sc.next();
            int lenb=sb.length();
            int lens=str.length();
            int sumlen=lenb-lens+1;
            boolean flag=false;
            for (int i = 0; i < sumlen; i++) {
                if(sb.substring(i,lens+i).toString().equals(str)){
                    System.out.println("第"+i+"次匹配成功");
                    flag=true;
                    break;
                }
            }
            if(flag){
                break;
            }else{
                System.out.println("请重新输入");
            }
        }

    }
}
